Skip to content

Commit

Permalink
Add NSSoundToSoundAdapter
Browse files Browse the repository at this point in the history
Issue #161
  • Loading branch information
eofster committed Jan 15, 2016
1 parent 56741b8 commit 7aeac54
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Telephone.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
AA1019881C490BF100869D01 /* RingtoneFactoryImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA1019831C490BD300869D01 /* RingtoneFactoryImpl.swift */; };
AA1019891C491BF900869D01 /* Domain.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = AA9D08031BFF7E6F0000F618 /* Domain.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
AA10198A1C491C0600869D01 /* UseCases.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = AA078B291BFF80E20013FF8F /* UseCases.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
AA10198E1C4946EE00869D01 /* NSSoundToSoundAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA10198D1C4946EE00869D01 /* NSSoundToSoundAdapter.swift */; };
AA167A1E0F07BF9E00AF8B71 /* SIPResponses.strings in Resources */ = {isa = PBXBuildFile; fileRef = AA167A1C0F07BF9E00AF8B71 /* SIPResponses.strings */; };
AA16CBE30F856A4A000CAFD1 /* AKNSString+Creating.m in Sources */ = {isa = PBXBuildFile; fileRef = AA16CBE20F856A4A000CAFD1 /* AKNSString+Creating.m */; };
AA16CBE60F856ACD000CAFD1 /* AKNSString+PJSUA.m in Sources */ = {isa = PBXBuildFile; fileRef = AA16CBE50F856ACD000CAFD1 /* AKNSString+PJSUA.m */; };
Expand Down Expand Up @@ -367,6 +368,7 @@
AA1019801C48F08A00869D01 /* SoundFactorySpy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SoundFactorySpy.swift; sourceTree = "<group>"; };
AA1019831C490BD300869D01 /* RingtoneFactoryImpl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RingtoneFactoryImpl.swift; sourceTree = "<group>"; };
AA1019851C490BE100869D01 /* RingtoneFactoryImplTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RingtoneFactoryImplTests.swift; sourceTree = "<group>"; };
AA10198D1C4946EE00869D01 /* NSSoundToSoundAdapter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSSoundToSoundAdapter.swift; sourceTree = "<group>"; };
AA167A1D0F07BF9E00AF8B71 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/SIPResponses.strings; sourceTree = "<group>"; };
AA167A480F0805B700AF8B71 /* Russian */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Russian; path = Russian.lproj/SIPResponses.strings; sourceTree = "<group>"; };
AA16CBE10F856A4A000CAFD1 /* AKNSString+Creating.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = "AKNSString+Creating.h"; sourceTree = "<group>"; tabWidth = 4; };
Expand Down Expand Up @@ -857,6 +859,7 @@
AA1019821C490BB900869D01 /* Ringtone */ = {
isa = PBXGroup;
children = (
AA10198D1C4946EE00869D01 /* NSSoundToSoundAdapter.swift */,
AA1019831C490BD300869D01 /* RingtoneFactoryImpl.swift */,
AA1019851C490BE100869D01 /* RingtoneFactoryImplTests.swift */,
);
Expand Down Expand Up @@ -1609,6 +1612,7 @@
8D11072D0486CEB800E47090 /* main.m in Sources */,
AA4BD4C80E07C28E005A71B2 /* AKSIPUserAgent.m in Sources */,
AA277A531BD174D60030ECE4 /* UserAgentSoundIOSelector.swift in Sources */,
AA10198E1C4946EE00869D01 /* NSSoundToSoundAdapter.swift in Sources */,
AA4BD4D80E07C305005A71B2 /* AppController.m in Sources */,
AA2C03F31BD7BE36001D25F9 /* CompositionRoot.swift in Sources */,
AABAD7ED0E0C171A00CB5930 /* PreferencesController.m in Sources */,
Expand Down
49 changes: 49 additions & 0 deletions Telephone/NSSoundToSoundAdapter.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// NSSoundToSoundAdapter.swift
// Telephone
//
// Copyright (c) 2008-2016 Alexei Kuznetsov. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// 3. Neither the name of the copyright holder nor the names of contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE THE COPYRIGHT HOLDER
// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

import UseCases

class NSSoundToSoundAdapter {
let sound: NSSound

init(sound: NSSound) {
self.sound = sound
}
}

extension NSSoundToSoundAdapter: Sound {
func play() {
sound.play()
}

func stop() {
sound.stop()
}
}

0 comments on commit 7aeac54

Please sign in to comment.